import React from 'react';
import { Button, Popconfirm } from 'antd';

export const getColumns = ({
    onToggle,
    onEdit,
}) => ([
    {
        title: '序号',
        dataIndex: 'index',
        key: 'index',
    },
    {
        title: '机构编号',
        dataIndex: 'order',
        key: 'order',
    },
    {
        title: '机构名称',
        dataIndex: 'name',
        key: 'name',
    },
    {
        title: '机构类型',
        dataIndex: 'type',
        key: 'type',
    },
    {
        title: '所属类型',
        dataIndex: 'belong',
        key: 'belong',
    },
    {
        title: 'operation',
        dataIndex: 'operation',
        render: (text, record) => {
            return (
                <div>
                    <Popconfirm placement="topLeft" title={'确定停止？'} onConfirm={() => onToggle(record)} okText="Yes" cancelText="No">
                        <Button>启用</Button>
                    </Popconfirm>
                    <Button onClick={() => onEdit(record)}>编辑</Button>
                </div>
            )
        },
    }
]);